        <script>
          start_price = 0;
          end_price = <?php echo $max_price; ?>;
          start_discount = 0;
          end_discount = 100;
          start_timeleft = 0;
          end_timeleft = <?php echo $max_left_date; ?>;
        </script>
        <div id="thesidebar">
          <form id="form">
            <div class="box tag_box">
              <div class="boxtitle closed">
                <a href="#this" class="">分类</a>
              </div><!-- end .boxtitle -->
              <div style="display: block;" class="boxcontent">
                <p class="boxoptions">
                  <a href="#this" id="selectmine" onclick="window.location.reload();">我关注的分类</a>
                  <span>|</span>
                  <a class="select_all" href="#this" id="selectAllKinds">全选</a>
                  <span>|</span>
                  <a href="#this" id="clearAllKinds">清空</a>
                </p>
                <!-- Tags get inserted here from ajax-->
                <?php foreach ($user_cat as $lev1_cat){ ?>
                <h6><?php echo $lev1_cat['cat_name']; ?> <!--<a href="#this" class="selectAllItems">[全选]</a>--></h6>
                <ul>
                	<?php
                		foreach ($lev1_cat['data'] as $lev2_cat) {
                			$item_check = $lev2_cat['valid'];
                	?>
                  <li class="tag_item">
                    <span class="resultnumber">
                      <a href="#this"><?php echo isset($cat_count[$lev2_cat['id']]) ? $cat_count[$lev2_cat['id']] : 0; ?></a>
                    </span>
                    <label>
                      <input <?php echo $lev2_cat['valid']?'checked="checked"':''; ?>name="tags" value="<?php echo $lev2_cat['id']; ?>" type="checkbox"> <?php echo $lev2_cat['cat_name']; ?>
                    </label> [<a class="only" href="#this">选中</a>]
                  </li>
                  	<?php } ?>
                </ul>
                <?php } ?>
              </div><!-- end .boxcontent -->

            </div><!-- end .box -->

            <div class="box tag_box">
              <div class="boxtitle closed">
                <a href="#this" class="">价格范围</a>
              </div><!-- end .boxtitle -->
              <div style="display: block;" class="boxcontent">
                <div style="padding:0 10px">
                  <input type="text" id="priceValue" readonly style="border:0;color:#666;font-weight:bold;margin-bottom:5px" />
                  <div id="price-range"></div>
                  <script>
                    $(function() {
                      $( "#price-range" ).slider({
                        range: true,
                        min: 0,
                        max: <?php echo $max_price; ?>,
                        values: [0, <?php echo $max_price; ?>],
                        slide: function( event, ui ) {
                          start_price = ui.values[ 0 ];
                          end_price = ui.values[ 1 ];
                          $( "#priceValue" ).val( "￥" + ui.values[ 0 ] + " - ￥" + ui.values[ 1 ] );
                        },
                        stop: function(event, ui) {
                          ajaxUpdateIndex();
                        }
                      });
                      $("#priceValue").val( "￥" + $( "#price-range" ).slider( "values", 0 ) + " - ￥" + $( "#price-range" ).slider( "values", 1 ));
                    })
                  </script>
                </div>
              </div>
            </div><!-- end .box -->

            <div class="box tag_box">
              <div class="boxtitle closed">
                <a href="#this" class="">来源</a>
              </div><!-- end .boxtitle -->
              <div style="display: block;" class="boxcontent">
                <p class="boxoptions">
                  <a class="select_all" href="#this" id="selectAllSites">全选</a>
                  <span>|</span>
                  <a href="#this" id="clearAllSites">清空</a>
                </p>
                <ul>
                <?php
					foreach ( $all_site_info as $site_id => $site_name){
						$is_site_check = $user_site == 'all' ? true : (is_array($user_site) && in_array($site_id,$user_site));
                ?>
                  <li class="site_item">
                    <span class="resultnumber">
                      <a href="#this"><?php echo $site_id_arr[$site_id]; ?></a>
                    </span>
                    <label>
                      <input type="checkbox" <?php echo $is_site_check?'checked="checked"':''; ?> value="<?php echo $site_id; ?>" name="sites"> <?php echo $site_name; ?>
                    </label>
                    [<a href="#this" class="only">选中</a>]
                  </li>
                 <?php } ?>
                </ul>
              </div>
            </div><!-- end .box -->

            <div class="box tag_box">
              <div class="boxtitle closed">
                <a href="#this" class="">折扣</a>
              </div><!-- end .boxtitle -->
              <div style="display: block;" class="boxcontent">
                <div style="padding:0 10px">
                  <input type="text" id="disaccountValue" readonly style="border:0;color:#666;font-weight:bold;margin-bottom:5px" />
                  <div id="disaccount-range"></div>
                  <script>
                    $(function() {
                      $( "#disaccount-range" ).slider({
                        range: true,
                        min: 0,
                        max: 100,
                        values: [0, 100],
                        slide: function( event, ui ) {
                          start_discount = ui.values[ 0 ];
                          end_discount = ui.values[ 1 ];
                          $( "#disaccountValue" ).val(ui.values[ 0 ] + "% - " + ui.values[ 1 ] + "%");
                          ajaxUpdateIndex();
                        },
                        stop: function(event, ui) {
                          ajaxUpdateIndex();
                        }
                      });
                      $("#disaccountValue").val($( "#disaccount-range" ).slider( "values", 0 ) + "% - " + $( "#disaccount-range" ).slider( "values", 1 ) + "%");
                    });
                  </script>
                </div>
              </div>
            </div><!-- end .box -->

            <div class="box tag_box">
              <div class="boxtitle closed">
                <a href="#this" class="">剩余时间</a>
              </div><!-- end .boxtitle -->
              <div style="display: block;" class="boxcontent">
                <div style="padding:0 10px">
                  <input type="text" id="timeValue" readonly style="border:0;color:#666;font-weight:bold;margin-bottom:5px" />
                  <div id="time-range"></div>
                  <script>
                    $(function() {
                      $( "#time-range" ).slider({
                        range: true,
                        min: 0,
                        max: <?php echo $max_left_date; ?>,
                        values: [0, <?php echo $max_left_date; ?>],
                        slide: function( event, ui ) {
                          start_timeleft = ui.values[ 0 ];
                          end_timeleft = ui.values[ 1 ];
                          $( "#timeValue" ).val(ui.values[ 0 ] + "天 - " + ui.values[ 1 ] + "天");
                          ajaxUpdateIndex();
                        },
                        stop: function(event, ui) {
                          ajaxUpdateIndex();
                        }
                      });
                      $("#timeValue").val($( "#time-range" ).slider( "values", 0 ) + "天 - " + $( "#time-range" ).slider( "values", 1 ) + "天");
                    });
                  </script>
                </div>
              </div>
            </div><!-- end .box -->
          </form>
        </div><!-- end #thesidebar -->